package com.example.javabasic.suanfa.剑指offer.双栈实现队列;

import java.util.Stack;

/**
 * @description 双栈实现队列
 * @Author Lin FuYuan
 * @date 2021/7/6
 */
public class Solution {
    Stack<Integer> stack1 = new Stack<Integer>();
    Stack<Integer> stack2 = new Stack<Integer>();

    public void push(int node) {
        stack1.push(node);
    }

    public int pop() {
        if(stack2.empty()){
            while(!stack1.empty()){
                stack2.push(stack1.pop());
            }
        }
        return stack2.pop();
    }

}
